﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using NUS.ISS.ARS.BusinessEntity;

namespace NUS.ISS.ARS.Service.Entity
{
    [DataContract]
    public class FlightScheduleData
    {
        [DataMember]
        public long FlightScheduleId { get; set; }
        [DataMember]
        public string FlightNumber { get; set; }
        [DataMember]
        public int FromAirportId { get; set; }
        [DataMember]
        public int ToAirportId { get; set; }
        [DataMember]
        public System.TimeSpan DepartureTime { get; set; }
        [DataMember]
        public System.TimeSpan ArrivalTime { get; set; }
        [DataMember]
        public decimal AdultFare { get; set; }
        [DataMember]
        public decimal ChildFare { get; set; }
        [DataMember]
        public decimal InfantFare { get; set; }
        [DataMember]
        public int AircraftId { get; set; }

        public static implicit operator FlightScheduleData(FlightSchedule f)
        {
            if (f.IsDeleted)
            {
                return null;
            }
            // Code to convert the book into an XML structure
            return new FlightScheduleData()
                {
                     FlightScheduleId=f.FlightScheduleId,
                     FlightNumber=f.FlightNumber,
                     FromAirportId=f.FromAirportId,
                     ToAirportId=f.ToAirportId,
                     DepartureTime=f.DepartureTime,
                     ArrivalTime=f.ArrivalTime,
                     AdultFare=f.AdultFare,
                     ChildFare=f.ChildFare,
                     InfantFare=f.InfantFare,
                     AircraftId=f.AircraftId
                };
        }
    }
}
